package com.example.video.common;

/**
 * 常量
 */
public class Constants {

    /**
     * 消息类型
     */
    public enum InformationTypeEnum {

        VEDIO(1, "视频"),
        NOTICE(2, "公告"),
        UPDATE(3, "更新");

        InformationTypeEnum(int code, String value) {
            this.code = code;
            this.value = value;
        }

        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        public static InformationTypeEnum codeOf(int code) {
            for (InformationTypeEnum informationTypeEnum : values()) {
                if (informationTypeEnum.getCode() == code) {
                    return informationTypeEnum;
                }
            }
            throw new RuntimeException("没有找到对应的枚举");
        }
    }

}
